<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <title>footer demo</title>
  <link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
  <link rel="stylesheet" type="text/css" href="index.css">
</head>
<body>
<div id="container" class="cm-content">
  <div id="footer">
    <div class="cm-content">
        <ul class="list">
          <li v-for="(item,index) in list" :style="styleWidth">
          <a :class="{active : count == index}" :href="item.href">
            <i :class="item.icon"></i>
            <span v-text="item.name"></span>
            <span v-if="index == 2 && cartCount > 0" class="count">19</span>
          </a>
          </li>
        </ul>
    </div>
  </div>
</div>
</body>
<script type="text/javascript" src="vue.js"></script>
<script>
  var vm = new Vue({
    el: '#footer',
    data: {
      list: [
        {name: '首页', icon: 'fa fa-2x fa-home', href: '#'},
        {name: '分类', icon: 'fa fa-2x fa-bars', href: '#'},
        {name: '购物车', icon: 'fa fa-2x fa-cart-plus', href: '#'},
        {name: '我的', icon: 'fa fa-2x fa-user-circle-o', href: '#'}
      ],
      count: 0,
      styleWidth: {
        width: '0%'
      },
      cartCount: 1
    },
    created: function() {
      var length = this.list.length;
      this.styleWidth.width = 100 / length + '%';
    }
  });
</script>
</html>